<!--
 * @Author: FengTeng
 * @Date: 2021-02-13 09:15:56
 * @LastEditTime: 2021-02-15 19:29:20
 * @LastEditors: FengTeng
 * @Description: Description
 * @FilePath: \spa-manage\src\components\spa-table\SpaTable.vue
-->
<template>
  <div class="spa-table">
    <el-table :data="tableData">
      <el-table-column
        v-for="column in columnSet"
        :prop="column.prop"
        :label="column.label"
        :width="column.width ? column.width : ''"
        :align="column.align ? column.align : ''"
        :key="column.prop"
      ></el-table-column>
      <slot></slot>
    </el-table>
    <el-pagination
      background
      layout="prev, pager, next"
      :total="tableConfig.pageConfig.total"
      @current-change="handlePageChange($event)"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  name: "SpaTable",
  props: {
    tableData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    tableConfig: {
      type: Object,
      default: () => {
        return {};
      }
    },
    columnSet: {
      type: Array,
      default: () => {
        return [];
      }
    }
  },
  data() {
    return {};
  },
  methods: {
    handlePageChange(event) {
      this.$emit("page-change", event);
    }
  }
};
</script>

<style lang="scss" src="./index.scss"></style>
